<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
	</head>
	<body>
	</body>
</html>

<script type="text/javascript">
	const view = {
		
		init() {
			this.getFoodList();
		},
		
		render(data) {
			console.log('data', data);
		},
		
		getFoodList() {
			console.log('this', this);	// 指向view		
			let url = 'https://www.easy-mock.com/mock/5b67edb475d70b78bbc6212e/xinyan/getFoodList';
			$.ajax({
				type: 'get',
				url,
//				success: function(res) {
//					console.log('this', this);  // ajax
//					// console.log(res);
//				}

				success: (res) => {
					console.log('this', this);
					this.render(res);
				}

			})
		}
		
	}
	view.init();
	
	
	
</script>
